package ahblue.cn.tanzi.model.home;

import android.content.Context;
import android.widget.Toast;

import java.util.List;

import ahblue.cn.tanzi.data.source.ApiCallback;
import ahblue.cn.tanzi.data.source.RemoteRepository;

/**
 * @author pink-jackstraw
 * @date 2018/11/19
 * @describe 视频评论
 */
public class VideoCommentlModel {

    public static void getComment(final Context context, String category_id, int page, String pageCount, final VideoCommentResult mListener) {
        RemoteRepository repo = RemoteRepository.getsInstance();
        repo.getComment(category_id, page + "", pageCount, new ApiCallback<VideoCommentlModel>() {
            @Override
            public void onSuccess(VideoCommentlModel data) {
                if (null != mListener) {
                    mListener.conver(data);
                }
            }

            @Override
            public void onFailed(String errorMsg) {
                Toast.makeText(context, errorMsg, Toast.LENGTH_LONG).show();
                if (null != mListener) {
                    mListener.conver(null);
                }
            }
        });
    }

    public static void getArticComment(final Context context, String category_id, int page, String pageCount, final VideoCommentResult mListener) {
        RemoteRepository repo = RemoteRepository.getsInstance();
        repo.getArticComment(category_id, page + "", pageCount, new ApiCallback<VideoCommentlModel>() {
            @Override
            public void onSuccess(VideoCommentlModel data) {
                if (null != mListener) {
                    mListener.conver(data);
                }
            }

            @Override
            public void onFailed(String errorMsg) {
                Toast.makeText(context, errorMsg, Toast.LENGTH_LONG).show();
                if (null != mListener) {
                    mListener.conver(null);
                }
            }
        });
    }

    public interface VideoCommentResult {
        void conver(VideoCommentlModel model);
    }

    public int count;
    public List<CommentBean> comment;

    public static class CommentBean {
        public String id;
        public String comment_content;
        public String add_time;
        public String user_id;
        public Object fabulous_id;
        public int fabulous_count;
        public UserDataBean user_data;
        public int early_time;

        public static class UserDataBean {
            public String member_id;
            public String member_name;
            public String member_avatar;
        }
    }
}
